blob: 7148aedd397e843c9ae4fa616144034ac7ffd839 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
import { Suspense } from "react"
import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import { redirect } from "next/navigation";
import { Shell } from "@/components/shell"
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
import { InformationButton } from "@/components/information/information-button"
import { useTranslation } from "@/i18n"
import { PcrTable } from "@/lib/pcr/table/pcr-table";
import { getPcrPoListForPartners } from "@/lib/pcr/service";
export const metadata = {
title: "PCR 관리",
description: "Purchase Change Request를 조회하고 관리할 수 있습니다.",
};
interface pageProps {
params: { lng: string }
}
async function PartnersPcrTableWrapper() {
// 세션에서 사용자 정보 확인
const session = await getServerSession(authOptions);
if (!session?.user?.id) {
redirect("/login");
}
const vendorId = session.user.companyId || 1;
// Partners용 데이터 조회 (현재 사용자의 vendorId에 해당하는 데이터만 조회)
const tableData = await getPcrPoListForPartners({
page: 1,
perPage: 10,
vendorId: vendorId,
});
return <PcrTable tableData={tableData} isEvcpPage={false} isPartnersPage={true} currentVendorId={vendorId} />;
}
export default async function PartnersPcrPage({ params }: pageProps) {
const { lng } = await params;
const { t } = await useTranslation(lng, 'menu')
return (
<Shell className="gap-4">
{/* ═══════════════════════════════════════════════════════════════ */}
{/* 페이지 헤더 */}
{/* ═══════════════════════════════════════════════════════════════ */}
<div className="flex items-center justify-between space-y-2">
<div className="flex items-center justify-between space-y-2">
<div>
<div className="flex items-center gap-2">
<h2 className="text-2xl font-bold tracking-tight">
{t('menu.vendor.procurement.pcr')}
</h2>
<InformationButton pagePath="partners/pcr" />
</div>
<p className="text-muted-foreground">
{t('menu.vendor.procurement.pcr_desc')}
</p>
</div>
</div>
</div>
{/* ═══════════════════════════════════════════════════════════════ */}
{/* 메인 테이블 */}
{/* ═══════════════════════════════════════════════════════════════ */}
<Suspense
fallback={
<DataTableSkeleton
columnCount={12}
searchableColumnCount={2}
filterableColumnCount={3}
cellWidths={["8rem", "8rem", "12rem", "12rem", "10rem", "12rem"]}
shrinkZero
/>
}
>
<PartnersPcrTableWrapper />
</Suspense>
</Shell>
);
}
|